<?php

use backend\Backend;
use backend\widgets\SidebarMenu;
use common\widgets\Gravatar;
use yii\helpers\Html;

?>
<aside class="main-sidebar">

    <section class="sidebar">

        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <?php echo Gravatar::widget([
                    'email' => Yii::$app->user->identity->email,
                    'options' => [
                        'alt' => Yii::$app->user->identity->username,
                        'class' => 'img-circle',
                    ],
                    'size' => 160
                ]); ?>
            </div>
            <div class="pull-left info">
                <p><?php echo Yii::$app->user->identity->username ?></p>

                <?php echo Html::a(
                    '<i class="fa fa-circle text-success"></i> ' . Yii::t('backend', 'Logout'),
                    [Backend::url('logout')],
                    ['data-method' => 'post']
                ) ?>
            </div>
        </div>

<!--        <form action="#" method="get" class="sidebar-form">-->
<!--            <div class="input-group">-->
<!--                <input type="text" name="q" class="form-control" placeholder="Search..."/>-->
<!--              <span class="input-group-btn">-->
<!--                <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i>-->
<!--                </button>-->
<!--              </span>-->
<!--            </div>-->
<!--        </form>-->

        <?php

        $items = Yii::$app->get('sidebarMenuProvider')->getItems();

        echo SidebarMenu::widget([
            'options' => [
                'class' => 'sidebar-menu'
            ],
            'items' => $items
        ]) ?>

    </section>

</aside>
